package offer;

public class offerII_0069 {
    public int peakIndexInMountainArray(int[] arr) {
        int len=arr.length;
        return search(arr,0,len-1);
    }
    public int search(int[] arr,int left,int right){
        int mid=left+(right-left)/2;
        if(arr[mid]>arr[mid-1]&&arr[mid]>arr[mid+1]) return mid;
        if(arr[mid]>arr[mid-1]) return search(arr,mid+1,right);
        return search(arr,left,mid);
    }
}
